import { defineStore } from 'pinia'
import { ref } from 'vue'
import { useTypeListService } from '@/api/request.js'

export const useTypeStore = defineStore(
  'typeStore',
  () => {
    // 分类列表
    const typeList = ref([])

    // 获取分类列表
    const getTypeList = async () => {
      const { data } = await useTypeListService()
      console.log(data)
      typeList.value = data
      // console.log(typeList.value)
    }
    return {
      typeList,
      getTypeList
    }
  },
  {
    persist: true // 持久化
  }
)
